import Koa from 'koa'
import Router from 'koa-router'
// const router = require('koa-router')();

const router = new Router()

router
    .get('/', (ctx, next) => {
        // if (ctx.path !== '/')
        //     return next();
        ctx.status = 200;
        ctx.body = 'OK!';
    })
    .get('/sse', async (ctx, next) => {
        // if (ctx.path !== '/sse')
        //     return await next();

        // ctx.status = 200;
        ctx.body = 'SSE!';
    })

new Koa()
    .use(router.routes())
    .listen(8080, _ => console.log('Listening on http://localhost:8080'));
